<template>
  <div  class="panel" :style="{'height':height+'%','width':width + '%'}">
    <div class="panel-header">
      <div class="header-left">
        <div class="border"></div>
        <img :src="icon"  class="icon">
        <p class="title">{{ title }}</p>
      </div>
      <ul class="header-right">
        <li></li>
        <li></li>
      </ul>
    </div>
    <div class="panel-content">
      <div class="content-border">
        <slot>

        </slot>
      </div>
    </div>
  </div>
</template>

<script>


export default{
  props:{
    height:{
      type:Number,
      default:30,
    },
    width:{
      type:Number,
      default:100,
    },
    title:{
      type:String,
      default:'标题文字',
    },
    icon:String,
  },
  directives:{
    panelHeight:{
      inserted(el, binding){
        el.style.height = binding.value
      }
    },
    panelWidth:{
      inserted(el, binding){
        el.style.width = binding.value
      }
    }
  }
}

</script>

<style scoped lang="less">
  .panel{
    width: 100%;
    height: 20vh;
  }
  .panel-header{
    width: 100%;
    height: 4vh;
    background: linear-gradient(-90deg, rgba(11,109,218,0) 0%, rgba(68,170,255,0.8) 81%, rgba(100,186,255,0.8) 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    .header-left{
      width: 90%;
      height: 100%;
      display: flex;
      align-items: center;
      .border{
        width: 1%;
        height: 100%;
        background: #87CDFF;
      }
      .icon{
        width: 2.2vmin;
        height: 2.2vmin;
        // background-color: rebeccapurple;
        margin: 0 1vmin;
      }
      .title{
        font-size: 20px;
        font-weight: 600;
        color: #FFFFFF;
        line-height: 26px;
      }
    }
    .header-right{
      width: 10%;
      height: 90%;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      list-style: none;
      align-items: end;
      li{
        width: 10%;
        height: 20%;
        background: #87cdff;
        box-shadow: 0px 0px 2px 0px #87CDFF;
      }
    }
  }
  .panel-content{
    height: calc(100% - 4vh );
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    .content-border{
      height: calc(100% - 1vh);
      width: calc(100% - 1vw);
    }
  }
</style>